package com.oop;


class animal{
    private String type;
    private String name;

    public animal(String type, String name) {
        this.type = type;
        this.name = name;
        System.out.println("执行有参构造");
    }




    public animal(){
        System.out.println("执行无参构造");

    }

    @Override
    public String toString() {
        return "animal{" +
                "type='" + type + '\'' +
                ", name='" + name + '\'' +
                '}';
    }
}






public class test02_gouzao {
    public static void main(String[] args) {
        animal dog = new animal("qqq","dog");
        animal cat = new animal();
        System.out.println(dog.toString());


    }


}
